import styled from 'styled-components'
import Icon from '@/components/Icon'
import img from '@img/all.png'

export const StyledPollModal = styled.div<{ superMtNum: 0 | 1 }>`
	padding: 20px 34px 0;
	.poll-plan-wrap {
		display: flex;
		.poll-plan,
		.poll-interval {
			display: flex;
			align-items: center;
			.poll-label {
				margin-right: 15px;
			}
		}
		.poll-interval {
			margin-left: 70px;
			.seconds {
				margin-left: 20px;
				display: flex;
				&.hide {
					display: none;
				}
				align-items: center;
				.seconds-input {
					margin-right: 15px;
				}
			}
		}
	}
	.transfer-wrap {
		position: relative;
		display: flex;
		margin-top: 20px;
		.left-list {
			height: 400px;
			width: 312px;
			.tab {
				position: relative;
				z-index: 1;
				span {
					box-sizing: content-box;
					display: inline-block;
					height: 34px;
					line-height: 34px;
					width: 90px;
					text-align: center;
					cursor: pointer;
					border: 1px solid transparent;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					&.selected {
						border: 1px solid #e5e5e5;
						border-top: 2px solid #1e94da;
						border-bottom: 1px solid #ffffff;
					}
				}
			}
			.content {
				position: absolute;
				top: ${(props) => (props.superMtNum === 0 ? '36px' : '0')};
				height: ${(props) => (props.superMtNum === 0 ? '400px' : '436px')};
				width: 312px;
				border: 1px solid #e5e5e5;
				padding: 0 10px;
				box-sizing: border-box;
				display: flex;
				flex-direction: column;
				.content-search {
					margin: 15px 0 8px;
				}
				.member-list {
					flex: 1;
				}
			}
		}
		.transfer-operate {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			width: 70px;
			.btn {
				display: block;
				width: 30px;
				height: 30px;
				margin-bottom: 20px;
				background-image: url(${img});
				cursor: pointer;
			}
			.all-right {
				background-position: -240px -365px;
				&:hover {
					background-position: -270px -365px;
				}
				&:active {
					background-position: -300px -365px;
				}
			}
			.right {
				background-position: 0px -395px;
				&:hover {
					background-position: -30px -395px;
				}
				&:active {
					background-position: -60px -395px;
				}
			}
			.left {
				background-position: -120px -395px;
				&:hover {
					background-position: -150px -395px;
				}
				&:active {
					background-position: -180px -395px;
				}
			}
			.all-left {
				margin-bottom: 0;
				background-position: -240px -395px;
				&:hover {
					background-position: -270px -395px;
				}
				&:active {
					background-position: -300px -395px;
				}
			}
		}
		.right-list {
			height: 434px;
			width: 312px;
			border: 1px solid #e5e5e5;
			.title {
				height: 32px;
				line-height: 32px;
				text-align: center;
				border-bottom: 1px solid #e5e5e5;
			}
			.content {
				height: calc(100% - 32px);
				padding: 0 8px;
				.member-list {
					height: 100%;
				}
			}
		}
		.right-operate {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			width: 50px;
			position: absolute;
			top: 0;
			bottom: 0;
			right: -10px;
			.btn {
				display: block;
				width: 30px;
				height: 30px;
				margin-bottom: 20px;
				background-image: url(${img});
				cursor: pointer;
			}
			.top {
				background-position: -120px -425px;
				&:hover {
					background-position: -150px -425px;
				}
				&:active {
					background-position: -180px -425px;
				}
			}
			.up {
				background-position: 0 -455px;
				&:hover {
					background-position: -30px -455px;
				}
				&:active {
					background-position: -60px -455px;
				}
			}
			.down {
				background-position: -120px -455px;
				&:hover {
					background-position: -150px -455px;
				}
				&:active {
					background-position: -180px -455px;
				}
			}
			.bottom {
				margin-bottom: 0;
				background-position: -240px -425px;
				&:hover {
					background-position: -270px -425px;
				}
				&:active {
					background-position: -300px -425px;
				}
			}
		}
	}
	.footer {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 22px;
		.msg {
			position: absolute;
			left: 0;
			color: #949799;
			height: 24px;
			line-height: 24px;
			display: flex;
			.icon-tips {
				margin-right: 8px;
			}
		}
	}
`
interface WrapProps {
	isCascade: boolean
	nestingLevel: number
	isVip: boolean
	isOnline: boolean
	isMeeting: boolean
	isNameBlue: boolean
	isSelected: boolean
	isAll: boolean
}
export const ItemLabelWrap = styled.div.attrs(({ isSelected }: WrapProps) => {
	return { className: `${isSelected ? 'selected' : ''}` }
})<WrapProps>`
	display: flex;
	flex: 1;
	align-items: center;
	height: 38px;
	box-sizing: border-box;
	padding-left: ${(props) => {
		if (props.isCascade && props.isAll) {
			if (props.isOnline && props.isMeeting) {
				return `${props.nestingLevel * 22 + 4}px`
			} else {
				return `${props.nestingLevel * 22 + (props.nestingLevel > 0 ? 10 : 0) + 4}px`
			}
		} else {
			return `26px`
		}
	}};
	overflow: hidden;
	user-select: none;
	&:hover {
		background: #c1dbec;
	}
	&.selected {
		background: linear-gradient(90deg, #2d8bc0, #53afe4);
		.name {
			color: #fff;
		}
	}
	.icon-yes {
		position: absolute;
		top: 12px;
		left: ${(props) => {
			if (props.isCascade && props.isAll) {
				return `${props.nestingLevel * 22 + (props.nestingLevel > 0 ? -14 : 0) + 4}px`
			} else {
				return `4px`
			}
		}};
	}
	.icon-toggle {
		flex: 0 0 14px;
		margin-right: 7px;
	}
	.icon-checked {
		/* flex: 0 0 14px;
		margin-right: 7px; */
		position: absolute;
		top: 12px;
		left: ${(props) => {
			if (props.isOnline && props.isMeeting) {
				return `${props.nestingLevel * 22 + 6}px`
			} else {
				return `${props.nestingLevel * 22 + (props.nestingLevel > 0 ? 10 : 0) + 6}px`
			}
		}};
	}
	.avatar {
		flex: 0 0 24px;
		display: flex;
		align-items: center;
		position: relative;
		margin-right: 8px;
		.icon-often {
			position: absolute;
			bottom: -2px;
			right: 0;
		}
	}
	.vip {
		flex: 0 0 26px;
		height: 15px;
		background-color: #5eb9ef;
		color: #ffffff;
		line-height: 15px;
		text-align: center;
		margin-right: 8px;
	}
	.name {
		color: ${(props) => (props.isOnline ? (props.isNameBlue ? `#2C8DC5` : `#000`) : `#959697`)};
		overflow: hidden;
		&.active-polling {
			color: #2bb7ff;
			font-weight: bold;
		}
		pre {
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
`
export const IconYes = styled(Icon).attrs((r) => ({ className: 'icon-yes' }))`
	width: 11px;
	height: 11px;
	background-position: -326px -1671px;
`
export const IconCheckbox = styled(Icon)<{ checked: boolean }>`
	width: 14px;
	height: 14px;
	cursor: pointer;
	background-position: ${(props) => (props.checked ? `-92px -1671px` : `-2px -1671px`)};
`
